package com.cskaoyan.controller;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.myenum.ResultEnum;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Fantasylkh
 */
@ControllerAdvice
public class ExceptionControllerAdvise {
    //shiro异常拦截
    @ExceptionHandler(AuthorizationException.class)
    @ResponseBody
    public BaseRespVo handlerAuthorException(Exception e) {
        return new BaseRespVo(ResultEnum.NO_PERMISSION);
    }
}
